package items;

import java.math.BigDecimal;
import java.math.MathContext;

public class Stockable extends Item {

	private String provider;
	private BigDecimal listPrice;
	private Double purchasePercentage;
	private Double salePercentage;
	
	public Stockable(String name, BigDecimal price, Double purchasePercentage, Double salePercentage) {
		super(name);
		this.listPrice = price;
		this.purchasePercentage = purchasePercentage;
		this.salePercentage = salePercentage;
	}

	//-----------Methods----------------
	
	/**
	 * Devuelve el precio de compra de un Stockeable
	 * @return BigDecimal
	 */
	public BigDecimal purchasePrice(){
		Double percent = (100 - this.getPurchasePercentage())/100;
		BigDecimal result = this.getListPrice().multiply(new BigDecimal(percent), MathContext.DECIMAL32);
		return result;
	}
	
	/**
	 * Devuelve el precio de venta de un Stockeable
	 * @return BigDecimal
	 */
	public BigDecimal salePrice(){
		Double percent = (100 + this.getSalePercentage())/100;
		BigDecimal result = this.purchasePrice().multiply(new BigDecimal(percent), MathContext.DECIMAL32);
		return result;
	}
	
	
	//-----------Sett&Gett---------------
	
	public void setProvider(String proveedor) {
		this.provider = proveedor;
	}

	public String getProvider() {
		return provider;
	}

	public void setListPrice(BigDecimal listPrice) {
		this.listPrice = listPrice;
	}

	public BigDecimal getListPrice() {
		return listPrice;
	}

	public void setPurchasePercentage(Double purchasePercentage) {
		this.purchasePercentage = purchasePercentage;
	}

	public Double getPurchasePercentage() {
		return purchasePercentage;
	}

	public void setSalePercentage(Double salePercentage) {
		this.salePercentage = salePercentage;
	}

	public Double getSalePercentage() {
		return salePercentage;
	}

}
